Skip to content

Conversation

@madaxen86
Copy link
Contributor

currently when the inner function of createAsync's inner function throws after an arg has updated, the error will not be caught by the closest ErrorBoundary that wraps the accessor. It will bubble up instead. Which is kind of inconsistent, because if there is an initial error it will be caught by the closest ErrorBoundary

wrapping the the prev in catchError and returning undefined instead resolves this.

[resource] = createResource(
    () =>
      subFetch(
        fn,
        catchError(
          () => untrack(prev),
          () => undefined
        )
      ),
    v => v,

Also added tests for a few different simple scenarios of create async.

Simple reproduction

@brenelz brenelz requested a review from ryansolid June 11, 2025 00:29
@changeset-bot
Copy link

changeset-bot bot commented Jun 11, 2025

🦋 Changeset detected

Latest commit: 8885abf

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

madaxen86 and others added 2 commits June 11, 2025 19:41
removed "test" from root tsconfig
Ensure that errors from previous async calls are caught to prevent them from bubbling up.
@ryansolid
Copy link
Member

Thank you. There are definitely some gaps because the way we hacked around createResource.

@ryansolid ryansolid merged commit edd273b into solidjs:main Nov 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants